import React from 'react'
import resetScroll from '../utils/resetScroll';


export default function withScroll(Comp) {
    return class ScrollWrapper extends React.Component {

        componentDidUpdate(prevProps) {
            if (this.props.location !== prevProps.location) {
                resetScroll()
            }
        }

        render() {
            return <Comp {...this.props} />;
        }
    }
}
